home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.onyx.net!newsmaster
- From: Nik.Palmer@onyx.octacon.co.uk (Nik Palmer)
- Newsgroups: comp.lang.c
- Subject: problem passing a string
- Date: Sat, 09 Mar 1996 12:36:03 GMT
- Organization: ONYX.net
- Message-ID: <4hrtsp$4mf@mulgave.octacon.co.uk>
- NNTP-Posting-Host: r03-17.onyx.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- Hi, Im using a textoutput routine in the fastgraph package of the
- form below
- void fg_print(char *string,int n);
- The string that I want to pass is initialised as below
-
- char string[6]
- double variable= 1.2345
- sprintf(string1,"%5f",variable)
-
- fg_print(string1,5)
-
- problem is it's outputting garbage, I know that string1 is only a
- pointer to the memory that holds the string, and that if I want to
- access the string I need string1[num]. So I think it's just
- outputting 5 bytes of memory from the memory location string1.
-
- How do I pass this routine the string??
- Thanks for your help.
- Nik
-
-